package com.zjc.yohoshop.mvp.model;

import com.zjc.lib_core.http.MResponseManager;
import com.zjc.lib_core.mvp.model.BaseModel;
import com.zjc.yohoshop.bean.AddCarEntity;
import com.zjc.yohoshop.bean.BaseEntity;
import com.zjc.yohoshop.bean.CarListEntity;
import com.zjc.yohoshop.bean.CollectionEntity;
import com.zjc.yohoshop.bean.SelGoodsValuesEntity;
import com.zjc.yohoshop.mvp.contract.CarListFragmentContract;
import com.zjc.yohoshop.network.API;

import java.util.Map;

import javax.inject.Inject;

import io.reactivex.Observable;

public class CarListFragmentModel extends BaseModel implements CarListFragmentContract.CarListFragmentIModel {


    @Inject
    public CarListFragmentModel() {}


    @Override
    public Observable<BaseEntity> request(Map<String, String> map) {
        Observable<CarListEntity> car_list = MResponseManager.obtainRetrofit(API.class).car_list_request(map.get("car_list"));
        Observable<SelGoodsValuesEntity> sel_goods_values = MResponseManager.obtainRetrofit(API.class).sel_goods_values_request(map.get("sel_goods_values"));
        return Observable.merge(car_list, sel_goods_values);
    }


    @Override
    public Observable<AddCarEntity> AddCarValues(String request) {
        return MResponseManager.obtainRetrofit(API.class).add_car_request(request);
    }

    @Override
    public Observable<CollectionEntity> CollectionValues(String request) {
        return MResponseManager.obtainRetrofit(API.class).collection_request(request);
    }

    @Override
    public void destroy() {

    }
}
